<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */
use Hyperf\Context\ApplicationContext;
use Hyperf\ExceptionHandler\Formatter\FormatterInterface;

/*
 * User: tc
 * Date: 2024/4/9
 * Email: <ggkm666777@gmail.com>.
 */
if (! function_exists('di')) {
    function di()
    {
        return ApplicationContext::getContainer();
    }
}

if (! function_exists('format_throwable')) {
    function format_throwable(Throwable $throwable)
    {
        return di()->get(FormatterInterface::class)->format($throwable);
    }
}
